package kitchen.beans;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * FoodMenu entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "food_menu", catalog = "delicacy")
public class FoodMenu implements java.io.Serializable {

	// Fields

	private String menuId;
	private User user;
	private String menuName;
	private Timestamp createDatetime;
	private Integer zan;
	private Set<FoodFoodMenuRelation> foodFoodMenuRelations = new HashSet<FoodFoodMenuRelation>(
			0);

	// Constructors

	/** default constructor */
	public FoodMenu() {
	}

	/** minimal constructor */
	public FoodMenu(String menuId, User user, String menuName,
			Timestamp createDatetime) {
		this.menuId = menuId;
		this.user = user;
		this.menuName = menuName;
		this.createDatetime = createDatetime;
	}

	/** full constructor */
	public FoodMenu(String menuId, User user, String menuName,
			Timestamp createDatetime, Integer zan,
			Set<FoodFoodMenuRelation> foodFoodMenuRelations) {
		this.menuId = menuId;
		this.user = user;
		this.menuName = menuName;
		this.createDatetime = createDatetime;
		this.zan = zan;
		this.foodFoodMenuRelations = foodFoodMenuRelations;
	}

	// Property accessors
	@Id
	@Column(name = "menu_id", unique = true, nullable = false, length = 50)
	public String getMenuId() {
		return this.menuId;
	}

	public void setMenuId(String menuId) {
		this.menuId = menuId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "owner", nullable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "menu_name", nullable = false, length = 50)
	public String getMenuName() {
		return this.menuName;
	}

	public void setMenuName(String menuName) {
		this.menuName = menuName;
	}

	@Column(name = "createDatetime", nullable = false, length = 19)
	public Timestamp getCreateDatetime() {
		return this.createDatetime;
	}

	public void setCreateDatetime(Timestamp createDatetime) {
		this.createDatetime = createDatetime;
	}

	@Column(name = "zan")
	public Integer getZan() {
		return this.zan;
	}

	public void setZan(Integer zan) {
		this.zan = zan;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "foodMenu")
	public Set<FoodFoodMenuRelation> getFoodFoodMenuRelations() {
		return this.foodFoodMenuRelations;
	}

	public void setFoodFoodMenuRelations(
			Set<FoodFoodMenuRelation> foodFoodMenuRelations) {
		this.foodFoodMenuRelations = foodFoodMenuRelations;
	}

}